package yunwo.cn.yzstation.adapter;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import yunwo.cn.yzstation.R;
import yunwo.cn.yzstation.base.BasicAdapter;
import yunwo.cn.yzstation.bean.GoodsinfoitemBean;

/**
 * Created by lao on 2017/10/13.
 */

public class GoodsInfoadatper extends BasicAdapter<GoodsinfoitemBean.DataBean.ListBean>{
    public GoodsInfoadatper(Context mctx) {
        super(mctx);
    }

    @Override
    protected int setItemLayout() {
        return R.layout.fragment_goodsinfoitem;
    }

    @Override
    protected void bindData(View convertView, GoodsinfoitemBean.DataBean.ListBean data, int position) {
        TextView waybill = get(convertView, R.id.waybill);
        TextView consignee = get(convertView, R.id.consignee);
        TextView destination = get(convertView, R.id.destination);
        TextView state = get(convertView, R.id.state);

        waybill.setText(data.getSubTrackingNumber());
        consignee.setText(data.getConsigneeName());
        destination.setText(data.getEndOrganName());
        switch (data.getStatus()) {
            case "4":
                state.setText("已受理");

                break;
            case "5":
                state.setText("短驳运输中");
                break;
            case "6":
                state.setText("待发车");
                break;
            case "7":
                state.setText("运输中");
                break;
            case "8":
                state.setText("待配送");
                break;
            case "9":
                state.setText("待签收");
                break;
            case "10":
                state.setText("已签收");
                state.setBackgroundResource(R.drawable.list_icon_zhuangtai);
                break;
            case "11":
                state.setText("已取消");
                state.setBackgroundResource(R.drawable.list_icon_zhuangtai);
                break;

        }
    }
}
